home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 0643B.ZIP / PRCHECK.ASM < prev    next >
Assembly Source File  |  1985-11-02  |  5KB  |  192 lines

  1. page 60,132
  2. comment  /:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3.           This is from Ashton-Tate's technotes, October 1985.  I left
  4.       out a few lines I thought were superfluous and changed a couple
  5.       of things, but by and large it is the same.  If
  6.       you change "com" to 1 and "d3dr" to 0 you will get a com file
  7.       which is virtually useless because ^c will knock it out, and
  8.       if the printer is actually broken that will be the only way to
  9.       escape short of a boot, which may corrupt any open index files.
  10.  
  11.           I don't think there really is any good way for a dbIII prog. to
  12.           check the printer if you're working with pre-1.2, and I have
  13.       stooped to using such workarounds as a batch file like this:
  14.       do while .t.
  15.         run prcheck
  16.         if file('PR.BAD')
  17.             option = ' '
  18.             do while at(option,'RT')=0
  19.                 @1,0 say 'Printer off-line, R)eturn to main menu, T)ry again' get option picture '!'
  20.                 read
  21.             enddo
  22.             if option = 'R'
  23.                 clos data
  24.                 return to master
  25.             endif
  26.         else
  27.             exit
  28.         endif
  29.       enddo
  30.  
  31.       rem prcheck.bat
  32.       del PR.BAD
  33.       prncheck    (diff. prog., sets errorlevel to 1 if not ok)
  34.       if errorlevel 1 echo>PR.BAD
  35.       exit
  36.  
  37.           And then if you don't want the screen to be screwed up,
  38.       you have to patch command.com to have echo off all the time.
  39.       ...anyway, now with v. 1.2, "run prcheck" is replaced with
  40.         pr_on = .f.
  41.         call prncheck with pr_on
  42.       and the "if file..." is replaced with "if .not. pr_on",
  43.       which is much more satisfactory (quicker!)
  44.  
  45.       to use, assemble and link, then convert either to a .bin file or
  46.       .com. file with exe2bin, and from v. 1.2 use "load prncheck(.bin)"
  47.  
  48.             Russell Freeland
  49.             305-764-1204  (voice only at present)
  50.             Ft. Lauderdale, FL 33315
  51.             11-2-85
  52.  
  53.         ** please pardon the tabs in the text, I created it with **
  54.         ** medit, but I checked, WS reads it OK             **
  55.  
  56.     ONE FINAL NOTE: THERE ARE A FEW CHANGES MARKED IN CAPITALS
  57.             WHICH WERE GIVEN TO ME BY RALPH DAVIS OF
  58.             ASHTON-TATE WHEN I CALLED HIM ABOUT INCORRECT
  59.             RESULTS ON THE AT.  WORKS WELL NOW, HOWEVER,
  60.                         I NEVER GET ANY MESSAGE EXCEPT 'PRINTER TURNED
  61.                         OFF' FROM THE COM PROGRAM.  ON MY AT, WHICH IS
  62.             DEFINITELY A NON-STANDARD SETUP, I GET 04CH IN
  63.             AX AFTER THE IN INSTRUCTION (048H AFTER ANDING
  64.             IT WITH 0F8H) WHEN THE "SELECT" BUTTON IS OFF,
  65.             WHICH I ALWAYS THOUGHT MEANT THE SAME AS OFF-LINE.
  66.             WHEN THE PRINTER IS NOT CONNECTED I GET FC (:=F8).
  67.             PLAY AROUND ON YOUR MACHINE AND LET ME KNOW IF YOU
  68.             GET DIFFERENT RESULTS, PLEASE.    YOU CAN CALL ME OR
  69.             LEAVE A MESSAGE ON DARWIN BBS, 212-819-7942.
  70.             THANX.
  71.  
  72.       ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  73.  
  74.       /
  75.  
  76.     com    equ    0    ;not for .com file this time,
  77.     d3dr    equ    1    ;rather for dbIII dev. release
  78.     true    equ    1
  79.     false    equ    0
  80. ;
  81. codeseg  segment byte public 'code'
  82.       assume cs:codeseg,es:codeseg
  83.  
  84. prntchk proc    far
  85.     if    com
  86.       org      100h
  87.     endif
  88. ;
  89. ;
  90. start:    jmp    begin
  91. ;
  92. messg1    db    'printer off-line - please adjust and press any key','$'
  93. messg2    db    'printer not turned on - please turn it on and press any key','$'
  94. ok    db    ?
  95. crlf    db    0dh,0ah,'$'    ;car. return & linefeed
  96. pr_str    equ    09h        ;DOS function call to print string
  97.  
  98. ;
  99. begin:
  100.     push    ax
  101.     push    bx
  102.     push    ds
  103.     push    es
  104.     push    cs
  105.     pop    es
  106.     mov    ax,40h        ;point to sys. data seg.
  107.     mov    ds,ax
  108.     mov    si,8        ;and to lpt1 port addr.
  109.     mov    dx,[si]     ;load pa into dx
  110.     inc    dx        ;point to status port
  111.     in    al,dx        ;and read it
  112.     AND     AL,0F8H        ;THIS LINE IS CORRECTED FROM TECHNOTES
  113.                 ;TO TURN OFF BITS THAT DIFFER FROM AT TO PC
  114.     cmp    al,0D8H     ;printer ok?  THIS LINE DIFFERENT TOO!
  115.     jne    off_line    ;no, check for off-line
  116.     mov    es:ok,true    ;yes, ok=true
  117.     jmp    short exit
  118. off_line:
  119.     cmp    al,0C8H        ;THIS ONE IS ALSO CORRECTED
  120.     jne    turned_off
  121.     mov    es:ok,false
  122.     if    com
  123.       mov      dx,offset messg1
  124.       call      printmessg
  125.       pop      es
  126.       pop      ds
  127.       pop      bx
  128.       pop      ax
  129.       call      wait        ;await keypress
  130.       mov      dx,offset crlf
  131.       call      printmessg
  132.       jmp      begin
  133.     endif
  134.     jmp    short exit
  135. turned_off:
  136.     mov    es:ok,false
  137.     if    com
  138.       mov      dx,offset messg2
  139.       call      printmessg
  140.       pop      es
  141.       pop      ds
  142.       pop      bx
  143.       pop      ax
  144.       call      wait        ;await keypress
  145.       mov      dx,offset crlf
  146.       call      printmessg
  147.       jmp      begin
  148.     endif
  149. exit:
  150.     pop    es
  151.     pop    ds
  152.     pop    bx
  153.     if    d3dr
  154.       mov      al,es:ok        ;move .t. or .f. to
  155.       mov      byte ptr [bx],al    ;db3 variable
  156.     endif
  157.     pop    ax
  158.     if    com
  159.       int      20h
  160.     else
  161.       ret
  162.     endif
  163. ;
  164. prntchk endp
  165. ;==================================
  166. ; subroutines  ====================
  167. ;==================================
  168. ;
  169. printmessg  proc near
  170.     push    ax
  171.     push    ds        ;save registers
  172.         mov     ax,es           ;es points to prncheck's data
  173.     mov    ds,ax
  174.     xor    ax,ax        ;zero ax
  175.     mov    ah,pr_str    ;print string function
  176.     int    21h
  177.     pop    ds
  178.     pop    ax
  179.     ret
  180. printmessg    endp
  181. ;
  182. wait    proc    near
  183.     push    ax
  184.     mov    ah,1
  185.     int    21h
  186.     pop    ax
  187.     ret
  188. wait    endp
  189. ;===================
  190. codeseg ends
  191.     end    start
  192.